<template>
    <div style="background: #f5f5f5;" id="holePage">
      <pagetop :text="text"></pagetop>
      <div @click="blank">
        <slideBar></slideBar>
        <div class="lunbo">
          <van-swipe :autoplay="3000">
            <van-swipe-item v-for="(v,i) in banner" :key="i">
              <img :src="v.img" alt="">
            </van-swipe-item>
          </van-swipe>
        </div>
        <div class="icon" align="center">
          <div>
            <router-link to="/selected">
              <img src="../assets/zipin.png" alt="" style="width: 5.87vw;height:6.67vw ;">
              <p style="color:#02C2E9;">产品中心</p>
            </router-link>
          </div>
          <div>
            <a href="#server">
              <img src="../assets/jiejue.png" alt="" style="width:4.3vw;height:6.4vw;">
              <p style="color:#F9A927;">解决方案</p>
            </a>

          </div>
          <div>
            <a href="#partener">
              <img src="../assets/daili.png" alt="" style="width:7.67vw;height: 5.26vw;">
              <p style="color:#4CD4B6;">代理加盟</p>
            </a>
          </div>

            <div>
              <router-link to="/aboutUs">
              <img src="../assets/aboutus.png" alt="" style="height: 6.4vw;width: 8.9vw;">
              <p style="color:#C757DD">关于我们</p>
              </router-link>
            </div>
        </div>
        <div style="width: 100vw;height: 26vw;">
          <router-link to="/APP" class="btnlink">
            <div class="btnBox">
              纳品网APP下载
            </div>
          </router-link>
        </div>
        <div class="video" style="position: relative;">
          <video controls  :src="video.video_link" type="video/mp4" :poster="video.img" style="object-fit:fill">
          </video>
        </div>
        <div class="company">
          <div style="font-size: 15px;color: #333;height: 13.33vw;width: 100vw;line-height: 13.33vw;border-bottom: 1px solid #f5f5f5;">公司动态</div>
          <router-link :to="{name:'newsDetail',params:{newsId:companyList.id}}">
            <div class="imgtext">
              <img :src="companyList.img" alt="">
              <div class="underimg">
                <span>{{companyList.title}}</span>
              <!--  <div>
                  <p class="content" v-html="companyList.content"></p>
                </div>-->
              </div>
            </div>
          </router-link>
          <router-link :to="{name:'newsDetail',params:{newsId:v.id}}" v-for="(v,i) in company_dynamics.second" :key="i" v-if="i<=2">
            <p style="overflow: hidden;white-space: nowrap;text-overflow: ellipsis">
              {{v.title}}
            </p>
          </router-link>
        </div>
        <div class="whoWeAre">
          <p style="font-size: 18px;color: #333;letter-spacing: 1vw;">我们是谁</p>
          <p style="font-size: 18px;color: #666;margin-top: 1.35vw;margin-bottom: 10vw">WHO WE ARE</p>
          <div class="imgBox">
            <div style="border: 1px solid #f5f5f5;position:relative;" class="outBox" v-for="(v,i) in our_message" :key="i" v-if="i<=3">
              <div class="circle">
                <div class="insetTxt">{{v.number}}<span>+</span></div>
              </div>
              <p style="margin-top: 4.67vw;">{{v.title}}</p>
              <p>{{v.desc}}</p>
              <div class="eng">{{v.eng}}</div>
            </div>
          </div>
        </div>
        <div class="napin">
          <p style="font-size: 15px;color: #333;margin-bottom: 5vw">纳品好友与你分享精彩世界</p>
          <homeGoodsCommend></homeGoodsCommend>
          <div class="more">
            <router-link to="/club" style="color:#666;">
            更多<van-icon name="arrow" size="1vw" color="#666" style="transform: scale(.7);position: relative;top: .2vw;"/>
            </router-link>
          </div>
        </div>
        <div class="selected">
          <p>更多精选好品尽在纳品</p>
          <div style="width: 92vw;height: auto;margin: 0px auto;margin-top: 4vw">
            <homeGoodsList ></homeGoodsList>
          </div>
          <div class="more" style="margin-top: 0vw">
            <router-link to="/selected" style="color:#666;">
              更多<van-icon name="arrow" size="1vw" color="#666" style="transform: scale(.7);position: relative;top: .2vw;"/>
            </router-link>
          </div>
        </div>
        <div class="zhuce">
          <div class="peoples">
            注册用户(人)
            <p>{{register.register_num}}</p>
          </div>
          <div class="vips">
            会员人数(人)
            <p>{{register.member_num}}</p>
          </div>
          <img src="../assets/zhuce.png" alt="">
        </div>
        <div class="partener" id="partener">
          <p>合作伙伴</p>
          <div class="imgBox">
            <div v-for="(w,index) in partener" :key="index" v-if="index<=8">
              <img :src="w.img" alt="">
            </div>
          </div>
        </div>
        <div style="margin-top: 4vw" id="server">
          <server></server>
        </div>
        <pageBottom></pageBottom>
        <gotop></gotop>
      </div>

    </div>
</template>

<script>
  import pagetop from '../components/pageTop'
  import homeGoodsCommend from '../components/homeGoodsCommend'
  import homeGoodsList from '../components/homeGoodsList'
  import server from '../components/server'
  import pageBottom from '../components/pageBottom'
  import slideBar from '../components/slideBar'
  import gotop from '../components/public/goTop'

    export default {
        name: "home",
      components:{
        pagetop,
        homeGoodsCommend,
        homeGoodsList,
        server,
        pageBottom,
        slideBar,
        gotop
      },
      data(){
          return{
            text:'纳品网',
            register:[],
            banner:[],
            video:[],
            partener:[],
            company_dynamics:[],
            our_message:[],
            companyList:[],
          }
      },
      methods:{
         blank(){
           $("#containers").css(
             {"transform":"translateX(0vw)","transition":"transform .3s"});

          },
          menu(){
            $("#containers").css(
              {"transform":"translateX(72vw)","transition":"transform .3s"});

          }
      },
      created(){
        var that=this;
        this.$http({
          url:'/offcial/index.php/index/Acticle/index',
          method:'post',
          data:{
            time:this._globe.time1,
            device_id:this._globe.device_id,
            version:this._globe.version,
            platform:this._globe.platform,
            token:this._globe.token1,
          }
        })
          .then(function (response) {
           /* console.log(response);*/
            const resData=response.data;
            if(resData.code==1){
              that.register=resData.data.register;
              that.banner=resData.data.banner;
              that.partener = resData.data.partener;
              that.video=resData.data.video;
              that.company_dynamics = resData.data.company_dynamics;
              that.companyList = resData.data.company_dynamics.list;
              that.our_message = resData.data.our_message;
            }
          })
          .catch(function (response) {
            console.log(response);
          })
      },
    }
</script>

<style scoped lang="scss">

  .bodys {
    width: 100vw;
    height: 12vw;
    justify-content: center;
    img {
      width: 4.5vw;
      height: 4.33vw;
      float: left;
      margin-left: 4vw;
      margin-top: 3.84vw;
    }
    p{
      font-size: 20px;
      line-height: 12vw;
      font-weight: bold;
    }
  }
.lunbo img{
  height: 60vw;
  width: 100vw;
}
.icon{
  width: 100vw;
  height: 26.67vw;
  padding-top: 6.93vw;
  background: #fff;
  display: flex;
  position: relative;
  box-sizing: border-box;
    div{
      flex: 1;
      height: 16vw;
      border-right: 1px solid #f5f5f5;
        p{
          position: absolute;
          bottom: 6.4vw;
          width: 24vw;
          font-size: 15px;
        }
    }
}
.btnBox{
  width: 58.67vw;
  height: 12.27vw;
  background: #FF4C50;
  color: #fff;
  font-size: 18px;
  line-height: 12.27vw;
  margin: 0px auto;
  margin-top:6.67vw;
  margin-bottom: 6.67vw;
  border-radius:6vw;
}
.video{
  width: 100vw;
  height: 53.33vw;
  margin-bottom: 4vw;
  video{
    width: 100%;
    height: 100%;
  }
}
.company{
  width: 100vw;
  height: auto;
  background: #fff;
  margin-bottom: 4vw;
  p{
    font-size: 15px;
    color: #333;
    height: 13.33vw;
    width: 100vw;
    line-height: 13.33vw;
    border-bottom: 1px solid #f5f5f5;
    text-align: left;
    text-indent: 4vw;
  }
  .imgtext{
    width: 100vw;
    height: 25.07vw;
    border-bottom:1px solid #f5f5f5;
      img{
        width: 26.67vw;
        height: 20vw;
        float: left;
        margin-left: 4vw;
        margin-top: 2.67vw;
      }
      .underimg{
      font-size: 14px;
      color: #666;
      text-align: left;
      margin-left: 4vw;
      float: left;
     /* width:100%;
        height: 100%;*/

      margin-top: 6.76vw;
        span{
          float: right;
        }
        p{
          float: right;
        }
        img{
          width: 26.67vw;
          height: 20vw;
          display: inline-block;
          float: left;
          margin-left: 4vw;
          margin-top: 2.67vw;
        }
        .content{
          width: 41.6vw;
          height: 20vw;
          display: -webkit-box;
          -webkit-box-orient: vertical;
          -webkit-line-clamp: 2;
          overflow: hidden;
          line-height: 19px;
          border: none;
          float: left;
        }
        span{
          font-size: 16px;
          color: #333;
          font-weight: bold;
          display: block;
          overflow: hidden;
          text-overflow: ellipsis;
          display: -webkit-box;
          -webkit-box-orient: vertical;
          -webkit-line-clamp: 2;

          width: 57.6vw;
          height: 12vw;
          margin-bottom: 0.76vw;
        }
    }
    }
}
.whoWeAre{
  width: 100vw;
  height: auto;
  background: #fff;
  padding-top: 8vw;
  box-sizing: border-box;
  margin-bottom: 4vw;
    .imgBox{
      width: 92vw;
      height: 129vw;
      margin: 0px auto;
      margin-bottom: 7.67vw;
      .circle{
        width: 32vw;
        height:32vw;
        border-radius: 50%;
        border: 2px solid #f5f5f5;
        margin-top: 7.2vw;
        margin-left: 7vw;
        .insetTxt{
          font-size: 40px;
          color: #999;
          position: relative;
          z-index: 100;
          text-align: center;
          line-height: 32vw;
          span{
            font-size: 21px;
          }
        }
      }
        .outBox{
          .eng{
            font-size: 12px;
            color: #999;
            position: absolute;
            right:5vw;
            top: 11vw;
            text-align: right;
            width: 16vw;
            height: 11vw;
            background: #fff;
          }

        }
      .outBox{
        width: 45vw;
        height: 62.4vw;
        display: inline-block;
        /*margin: 0px auto;*/
        float: left;
        margin: 0px 0px -1px -1px;
          img{
            height: 32vw;
            margin-top: 7.2vw;
          }
          p{
            font-size: 13px;
            color: #333;
          }
      }

    }
}
.napin{
    width: 100vw;
    height: auto;
    background: #fff;
    padding-top: 5.33vw;
  }
.selected{
  width: 100vw;
  height: auto;
  background: #fff;
  padding-top: 5.33vw;
  margin-top: 4vw;
    p{
      font-size: 15px;
      color: #333;
    }
}
.more{
    font-size: 11px;
    color: #666;
    margin-top: 6.4vw;
    height: 7.4vw;
  }
.zhuce{
  width: 100vw;
  height: 38.4vw;
  background: #fff;
  margin-top: 4vw;
  padding-top: 6.4vw;
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
    .peoples{
      font-size: 13px;
      color: #666;
      text-align: left;
      margin-left: 14vw;
      display: inline-block;
      float: left;
        p{
          color: #FF4C50;
          font-size: 24px;
          margin-top: 2vw;
        }
    }
    .vips{
    font-size: 13px;
    color: #666;
    text-align: left;
    margin-left: 14vw;
    float: right;
    margin-right: 14vw;
    p{
      color: #FF4C50;
      font-size: 24px;
      margin-top: 2vw;
    }
  }
    img{
      width: 100vw;
      height: 14.93vw;
      margin-top: 2vw;
    }
}
.partener{
  width: 100vw;
  height: 56vw;
  padding-top: 6.4vw;
  background: #fff;
  margin-top: 4vw;
    .imgBox{
      width: 100vw;
      height: 40vw;
      margin-top: 3vw;
        div{
          width: 33.6vw;
          height: 14vw;
          border:1px solid #f5f5f5;
          display: inline-block;
          float: left;
          border-collapse:collapse;
          margin: 0px 0px -1px -1px;
          position: relative;
          img{
              width: 70%;
              height: 70%;
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            margin: auto;
            }
        }
    }
}
  .btnlink{
    width: 58.67vw;
    height: 12.27vw;
    display: inline-block;
  }
  @media screen and (max-width: 375px) and (min-width: 320px){
    .underimg{
      font-size: 12px !important;
    }
    .underimg span{
      font-size: 14px !important;
    }
    .company p{
      font-size: 13px !important;
    }
    .icon div p{
      font-size: 13px !important;
    }
  }
  @media screen and(min-width: 411px){
    .partener .imgBox div{
      width: 33.55vw !important;
    }
    .company .imgtext .underimg .content{
      height: 9vw;
    }
  }
  .whoWeAre .imgBox .outBox:nth-child(1){
      border-left:none !important;
    border-top: none !important;
  }
  .whoWeAre .imgBox .outBox:nth-child(2){
    border-right:none !important;
    border-top: none !important;
  }
  .whoWeAre .imgBox .outBox:nth-child(3){
    border-left:none !important;
    border-bottom: none !important;
  }
  .whoWeAre .imgBox .outBox:nth-child(4){
    border-right:none !important;
    border-bottom: none !important;
  }
</style>
